
package Sgdb::SourceSyntaxAsm ;


#  This is a 'stupid' one function module. It was 
#  separated from the Sgdb::SourcePane module for 
#  the sake of portability.

use warnings ;
use strict ;
use integer ;
use bytes ;

sub parse {

    my $file = shift or die "arg" ;
    open FILE, $file or return ["can't open the file $file: $!\n"] ;
                                # speed, speed and speed
    my @file ;

    foreach (<FILE>) {

        if    ( /^\s*[\|\;\#\!]/ ) {

            push ( @file ,
                   $_ => 'face-comments'
                   ) ;
        }
        elsif ( /^(\S+)(\s+\S+)(\s+\S+)(.*)/s ) {

            push ( @file,
                   $1 => 'face-instructs',
                   $2 => 'face-keywords',
                   $3 => 'face-code',
                   $4 => 'face-comments'
                   ) ;
        }
        elsif ( /^(\S+)(\s+\S+)(.*)/s ) {

            push ( @file,
                   $1 => 'face-instructs',
                   $2 => 'face-keywords',
                   $3 => 'face-code'
                   ) ;
        }
        elsif ( /^(\S+)(.*)/s ) {

            push ( @file,
                   $1 => 'face-instructs',
                   $2 => 'face-code',
                   ) ;
        }
        elsif ( /^(\s*\S+\s+)(\S+)(.*)/s ) {

            push ( @file ,
                   $1 => 'face-keywords',
                   $2 => 'face-code',
                   $3 => 'face-comments'
                   ) ;
        } 
        else {

            push ( @file,
                   $_ =>'face-code'
                   ) ;
        }
    }
    \@file ;
}


'end'
